<?php
namespace Core\Service;
use Phalcon\Di\Injectable;
class Component extends Injectable {
    public function register() {
        $this->di->setShared('component', new class {
            public function __get($adapter) {
                $adapter = ucfirst($adapter);
                $class = "\\Core\\Component\\{$adapter}\\{$adapter}";
                if(!class_exists($class)) {
                    $class = "\\{$adapter}";
                }
                return new $class();
            }
        });
        return $this;
    }
}